home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
wwais103
/
view.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
9KB
|
304 lines
VERSION 2.00
Begin Form view_form
BackColor = &H00FFFFFF&
Caption = "View"
ClientHeight = 6915
ClientLeft = 210
ClientTop = 345
ClientWidth = 9360
DrawMode = 6 'Invert
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Terminal"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 7320
Left = 150
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 6915
ScaleWidth = 9360
Top = 0
Width = 9480
Begin Frame Frame1
BackColor = &H0080FF80&
Height = 855
Left = 0
TabIndex = 3
Top = 6120
Width = 9615
Begin CommandButton view_done
Caption = "&Done"
Height = 375
Left = 2760
TabIndex = 2
Top = 240
Width = 1095
End
Begin CommandButton view_save
Caption = "&Save"
Height = 375
Left = 1560
TabIndex = 1
Top = 240
Width = 1095
End
Begin CommandButton view_addsec
Caption = "&Add Section"
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 1215
End
End
Begin TextBox Text1
BackColor = &H00FFFFFF&
Height = 6135
Left = 0
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 4
Text = "Text1"
Top = 0
Width = 9375
End
End
Dim rec As String * 80
Dim word(19) As String
Dim recno As Integer
Dim doc_lines As Integer
Dim lines_per_page As Integer
Dim line_size As Single
Dim box_top As Single
Dim box_bottom As Single
Dim box_drawn As Integer
Dim button_down As Integer
Sub CheckNewLines (LineFrom As String, FileNum As Integer)
Do Until EOF(FileNum)
char$ = Input$(1, FileNum)
If char$ <> Chr$(13) Then
If char$ <> Chr$(10) Then
LineFrom$ = LineFrom$ + char$
Else
GotFeed% = True
If EOF(FileNum) Then
Exit Do
End If
EndLine$ = Input$(1, FileNum)
If EndLine$ = Chr$(10) Or EndLine$ = Chr$(13) Then
EndLine$ = Chr$(13) + Chr$(10)
LineFrom$ = LineFrom$ + EndLine$
ElseIf EndLine$ <> Chr$(13) Then
EndLine$ = Chr$(13) + Chr$(10) + EndLine$
LineFrom$ = LineFrom$ + EndLine$
End If
End If
Else
GotReturn% = True
If EOF(FileNum) Then
Exit Do
End If
char$ = Input$(1, FileNum)
If char$ = Chr$(10) Then
GotCR_LF% = True
EndLine$ = Chr$(13) + Chr$(10)
ElseIf char$ = Chr$(13) Then
EndLine$ = Chr$(13) + Chr$(10)
Else
EndLine$ = Chr$(13) + Chr$(10) + char$
End If
LineFrom$ = LineFrom$ + EndLine$
If GotCR_LF% = True Then
Exit Do
End If
End If
Loop
End Sub
Sub Form_Load ()
Open "wais.$$$" For Input As 1
If LOF(1) > 60000 Then
text1.Text = "File too Large for Display - Press Save to Save it"
Else
CheckNewLines Lines$, 1
Do Until EOF(1)
Line Input #1, NextLine$
Lines$ = Lines$ + NextLine$ + Chr$(13) + Chr$(10)
Loop
text1.Text = Lines$
End If
Close (1)
z = DoEvents()
End Sub
Sub show_page ()
Dim wdno As Integer
Static init_find As Integer
Static pos As Integer
If Not init_find Then
GoSub first_find
End If
view_form.Cls
ln = -1
For X = recno To recno + lines_per_page
If X < doc_lines Then
Get #1, X, rec
view_form.Print " "; rec
ln = ln + 1
If question_form.keywords.Text <> "" Then
rec = LCase$(rec)
For Y = 0 To wdno
pos = 1
While pos > 0
pos = InStr(pos, rec, word(Y))
If pos > 0 Then
view_form.drawmode = 7
wd_left = pos * view_form.TextWidth("A")
wd_right = (pos + Len(word(Y))) * view_form.TextWidth("A")
wd_top = ln * view_form.TextHeight("A")
wd_bottom = wd_top + view_form.TextHeight("A")
view_form.Line (wd_left, wd_top)-(wd_right, wd_bottom), &HFFFF&, BF
view_form.drawmode = 6
currentx = 0
pos = pos + Len(word(Y))
End If
Wend
Next Y
End If
End If
Next X
Exit Sub
first_find:
words$ = LCase$(question_form.keywords.Text)
c1 = 1
For wdno = 0 To 19
c2 = InStr(c1, words$, " ")
If c2 = 0 Then
word(wdno) = Left$(words$, Len(words$) - c1 + 1)
Exit For
End If
word(wdno) = Mid$(words$, c1, c2 - c1)
c1 = c2 + 1
If word(wdno) = "and" Or word(wdno) = "" Or word(wdno) = Space$(Len(word(wdno))) Then
wdno = wdno - 1
End If
Next wdno
init_find = True
Return
End Sub
Sub view_addsec_Click ()
lwidth% = text1.width / TextWidth("a")
If text1.SelLength < 1 Then
MsgBox ("You haven't selected a section to add")
Exit Sub
End If
ref = question_form.reference.listcount
title = question_form.title.listindex
l1% = text1.SelStart / lwidth%
ref_start(ref) = l1%
l2% = (text1.SelStart + text1.SelLength) / lwidth%
ref_end(ref) = l2%
ref_doc_size(ref) = title_doc_size(title)
ref_type(ref) = title_type(title)
ref_doc_bytes(ref) = title_doc_bytes(title)
ref_title$ = question_form.title.Text
ref_line$ = "[" + LTrim$(Str$(ref_start(ref))) + "," + LTrim$(Str$(ref_end(ref))) + "]" + Right$(ref_title$, Len(ref_title$) - 11)
question_form.reference.AddItem ref_line$
End Sub
Sub view_done_Click ()
Unload view_form
End Sub
Sub view_save_Click ()
Dim rec As String * 500
If InStr(title_type(title), "TEXT") Then
save_form.Show 1
ElseIf InStr(title_type(title), "WSRC") Then
new_src_form.s_add_server.Text = ""
new_src_form.s_add_port.Text = ""
new_src_form.s_add_database.Text = ""
Close (1)
Open "wais.$$$" For Input As 1
Do Until EOF(1)
Line Input #1, rec
last = 1
If InStr(last, LCase$(Left$(rec, Len(rec))), ":ip-name") Then
c1 = InStr(rec, Chr$(34))
c2 = InStr(c1 + 1, rec, Chr$(34))
last = c2 + 1
new_src_form.s_add_server.Text = Mid$(rec, c1 + 1, c2 - c1 - 1)
End If
If InStr(last, LCase$(Left$(rec, Len(rec))), ":tcp-port") > 1 Then
i = InStr(last, LCase$(Left$(rec, Len(rec))), ":tcp-port") + 9
port$ = Str$(Val(Mid$(rec, i, Len(rec) - 10)))
new_src_form.s_add_port.Text = Right$(port$, Len(port$) - 1)
last = i
End If
If InStr(last, LCas